import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:tracker/common/enums/user_type_enum.dart';
import 'package:tracker/pages/home/home/model/home_device_info_resp.dart';
import 'package:tracker/pages/home/home/model/user_info_resp.dart';
import 'package:tracker/provider/notifier/device_info_notifier.dart';
import 'package:tracker/provider/notifier/user_info_notifier.dart';

/// 记住密码
final rememberPasswordProvider = StateProvider((ref) => false);

/// 用户类型
final userTypeProvider = StateProvider<UserTypeEnum>((ref) {
  // 读取用户数据
  final userInfo = ref.watch(userInfoProvider);
  return userInfo.type != null ? UserTypeEnum.fromValue(userInfo.type!) : UserTypeEnum.none;
});

/// 用户数据
final userInfoProvider = StateNotifierProvider<UserInfoNotifier, UserInfoData>((ref) => UserInfoNotifier());

/// 设备数据
final deviceInfoProvider = StateNotifierProvider<DeviceInfoNotifier, DeviceInfoVO>((ref) {
  return DeviceInfoNotifier(ref);
});

/// 是否显示过充值弹窗提示
bool hasShowRechargeDialog = false;
